package game;
import java.util.Arrays;
import java.util.Scanner;

public class Teacher {
	
	/**
	 * 老师说出三个特殊数，返回的数用于初始一局游戏
	 */
	public int[] sayStart() {
		
		int[] nums = new int[3];
		
		System.out.println("给三个特殊数(数之间用逗号间隔)");
		Scanner input=new Scanner(System.in);
		String line = input.nextLine().trim(); 
		line = line.replaceAll("\\s*", "");
		String[] array=line.split(","); 
		
		while (array.length != 3) {//特殊情况处理：可能输入时不小心回车
			
			System.out.println("请再给出"+(3-array.length)+"个数");
			
			line = input.nextLine().trim(); 
			line = line.replaceAll("\\s*", "");
			String[] arr=line.split(","); 
			String[] temp = Arrays.copyOf(array, array.length + arr.length);
			System.arraycopy(arr, 0, temp, array.length, arr.length);
			
			array = temp;
		}

        
		for(int i = 0; i < nums.length; i++){
			 nums[i] = Integer.parseInt(array[i]);
		}
		input.close();	
		
		return nums;
	}
}
